<?php

    header("Content-type:text/html;charset=utf8");

    class Site {
        // 成员变量
        var $url;
        var $title;

        /**
         * Site constructor.
         * @param $pal
         * @param $par
         */
        function __construct($pal,$par){
            $this->url=$pal;
            $this->title=$par;
        }

        // 成员函数
        function setUrl($pal){
            $this->url=$pal;
        }

        function getUrl(){
            echo $this->url . PHP_EOL;
        }

        function setTitle($par){
            $this->title=$par;
        }
        function getTitle(){
            echo $this->title . PHP_EOL;
          
        }
    }

    $runOob=new Site('www.w3cschool.com','w3c官网');
    $taoBao=new Site('www.taobao.com','淘宝官网');
    $google=new Site('www.google.com','google');

    // 调用成员函数,获取标题和URL
    $runOob->getTitle();
    $taoBao->getTitle();
    $google->getTitle();

    $runOob->getUrl();
    $taoBao->getUrl();
    $google->getUrl();
